{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Using TensorFlow backend.\n",
      "/home/ma-user/anaconda3/envs/TensorFlow-1.13.1/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
      "  _np_qint8 = np.dtype([(\"qint8\", np.int8, 1)])\n",
      "/home/ma-user/anaconda3/envs/TensorFlow-1.13.1/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
      "  _np_quint8 = np.dtype([(\"quint8\", np.uint8, 1)])\n",
      "/home/ma-user/anaconda3/envs/TensorFlow-1.13.1/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
      "  _np_qint16 = np.dtype([(\"qint16\", np.int16, 1)])\n",
      "/home/ma-user/anaconda3/envs/TensorFlow-1.13.1/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
      "  _np_quint16 = np.dtype([(\"quint16\", np.uint16, 1)])\n",
      "/home/ma-user/anaconda3/envs/TensorFlow-1.13.1/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
      "  _np_qint32 = np.dtype([(\"qint32\", np.int32, 1)])\n",
      "/home/ma-user/anaconda3/envs/TensorFlow-1.13.1/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
      "  np_resource = np.dtype([(\"resource\", np.ubyte, 1)])\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import os\n",
    "import re\n",
    "import scipy.io as scio\n",
    "\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import scipy.signal\n",
    "from keras.models import Sequential,Model,load_model\n",
    "from keras.optimizers import Adam\n",
    "from sklearn.preprocessing import LabelBinarizer\n",
    "from sklearn import preprocessing\n",
    "from keras.layers import *\n",
    "import matplotlib.pyplot as plt\n",
    "from sklearn.model_selection import train_test_split\n",
    "import itertools\n",
    "from sklearn.metrics import confusion_matrix\n",
    "from keras.callbacks import ReduceLROnPlateau\n",
    "from keras import backend as k\n",
    "from keras.callbacks import ModelCheckpoint"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "产生数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "raw_num = 240\n",
    "col_num = 2000\n",
    "\n",
    "class Data(object):\n",
    "    \n",
    "    def __init__(self):\n",
    "        self.data = self.get_data()\n",
    "        self.label = self.get_label()\n",
    "        \n",
    "    def file_list(self):\n",
    "        return os.listdir('data/')\n",
    "    \n",
    "    def get_data(self):\n",
    "        file_list = self.file_list()\n",
    "        for i in range(len(file_list)):\n",
    "            file = scio.loadmat('data/{}'.format(file_list[i]))\n",
    "            for k in file.keys():\n",
    "                file_matched = re.match('X\\d{3}_DE_time', k)\n",
    "                if file_matched:\n",
    "                    key = file_matched.group()\n",
    "            if i == 0:\n",
    "                data = np.array(file[key][0:480000].reshape(raw_num,col_num))\n",
    "            else:\n",
    "                data = np.vstack((data, file[key][0:480000].reshape((raw_num,col_num))))\n",
    "        return data\n",
    "    \n",
    "    def get_label(self):\n",
    "        file_list = self.file_list()\n",
    "        title = np.array([i.replace('.mat', '') for i in file_list])\n",
    "        label = title[:, np.newaxis]\n",
    "        label_copy = np.copy(label)\n",
    "        for _ in range(raw_num-1):\n",
    "            label = np.hstack((label, label_copy))\n",
    "        return label.flatten()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(2400, 250)\n"
     ]
    }
   ],
   "source": [
    "Data = Data()\n",
    "data = Data.data\n",
    "label = Data.label\n",
    "lb = LabelBinarizer()\n",
    "y = lb.fit_transform(label)\n",
    "\n",
    "# Wiener filtering\n",
    "data_wiener = scipy.signal.wiener(data, mysize=3, noise=None)\n",
    "\n",
    "# downsampling\n",
    "index = np.arange(0,2000, 8)\n",
    "data_samp = data_wiener[:, index]\n",
    "print(data_samp.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_train, X_test, y_train, y_test = train_test_split(data_samp, y, test_size=0.3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "def built_model():\n",
    "    \n",
    "    input_seq = Input(shape=(250,))\n",
    "    X = Reshape((1,250))(input_seq)\n",
    "    \n",
    "    # encoder1\n",
    "    ec1_layer1 = Conv1D(filters=50, kernel_size=20, strides=2,\n",
    "                       padding='valid', activation='tanh',\n",
    "                       data_format='channels_first')(X)\n",
    "    ec1_layer2 = Conv1D(filters=30, kernel_size=10, strides=2,\n",
    "                      padding='valid', activation='tanh',\n",
    "                      data_format='channels_first')(ec1_layer1)\n",
    "    ec1_outputs = MaxPooling1D(pool_size=2, strides=None, padding='valid',\n",
    "                             data_format='channels_first')(ec1_layer2)\n",
    "    \n",
    "    # encoder2\n",
    "    ec2_layer1 = Conv1D(filters=50, kernel_size=6, strides=1,\n",
    "                       padding='valid', activation='tanh',\n",
    "                       data_format='channels_first')(X)\n",
    "    ec2_layer2 = Conv1D(filters=40, kernel_size=6, strides=1,\n",
    "                      padding='valid', activation='tanh',\n",
    "                      data_format='channels_first')(ec2_layer1)\n",
    "    ec2_layer3 = MaxPooling1D(pool_size=2, strides=None, padding='valid',\n",
    "                             data_format='channels_first')(ec2_layer2)\n",
    "    ec2_layer4 = Conv1D(filters=30, kernel_size=6, strides=1,\n",
    "                       padding='valid', activation='tanh',\n",
    "                       data_format='channels_first')(ec2_layer3)\n",
    "    ec2_layer5 = Conv1D(filters=30, kernel_size=6, strides=2,\n",
    "                       padding='valid', activation='tanh',\n",
    "                       data_format='channels_first')(ec2_layer4)\n",
    "    ec2_outputs = MaxPooling1D(pool_size=2, strides=None, padding='valid',\n",
    "                             data_format='channels_first')(ec2_layer5)\n",
    "    \n",
    "    encoder = multiply([ec1_outputs, ec2_outputs])\n",
    "    \n",
    "    dc_layer1 = LSTM(60, return_sequences=True)(encoder)\n",
    "    dc_layer2 = LSTM(60)(dc_layer1)\n",
    "    dc_layer3 = Dropout(0.5)(dc_layer2)\n",
    "    dc_layer4 = Dense(10, activation='softmax')(dc_layer3)\n",
    "    \n",
    "    model = Model(input_seq, dc_layer4)\n",
    "    \n",
    "    return model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "def plot_confusion_matrix(cm, classes, title='Confusion matrix', cmap=plt.cm.Blues, normalize=False):\n",
    "    plt.imshow(cm , cmap=cmap)\n",
    "    plt.title(title)\n",
    "    plt.colorbar()\n",
    "    tick_mark = np.arange(len(classes))\n",
    "    plt.xticks(tick_mark, classes, rotation=40)\n",
    "    plt.yticks(tick_mark, classes)\n",
    "    if normalize:\n",
    "        cm = cm.astype('float')/cm.sum(axis=1)[:,np.newaxis]\n",
    "        cm = '%.2f'%cm\n",
    "    thresh = cm.max()/2.0\n",
    "    for i,j in itertools.product(range(cm.shape[0]), range(cm.shape[1])):\n",
    "        plt.text(j,i,cm[i,j], horizontalalignment='center',color='black')\n",
    "    plt.tight_layout()\n",
    "    plt.ylabel('True label')\n",
    "    plt.xlabel('Predict label')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "import time\n",
    "begain_time = time.time()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "WARNING:tensorflow:From /home/ma-user/anaconda3/envs/TensorFlow-1.13.1/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "Colocations handled automatically by placer.\n",
      "WARNING:tensorflow:From /home/ma-user/anaconda3/envs/TensorFlow-1.13.1/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:3445: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob`.\n",
      "__________________________________________________________________________________________________\n",
      "Layer (type)                    Output Shape         Param #     Connected to                     \n",
      "==================================================================================================\n",
      "input_1 (InputLayer)            (None, 250)          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "reshape_1 (Reshape)             (None, 1, 250)       0           input_1[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "conv1d_3 (Conv1D)               (None, 50, 245)      350         reshape_1[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "conv1d_4 (Conv1D)               (None, 40, 240)      12040       conv1d_3[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "max_pooling1d_2 (MaxPooling1D)  (None, 40, 120)      0           conv1d_4[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "conv1d_1 (Conv1D)               (None, 50, 116)      1050        reshape_1[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "conv1d_5 (Conv1D)               (None, 30, 115)      7230        max_pooling1d_2[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "conv1d_2 (Conv1D)               (None, 30, 54)       15030       conv1d_1[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "conv1d_6 (Conv1D)               (None, 30, 55)       5430        conv1d_5[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "max_pooling1d_1 (MaxPooling1D)  (None, 30, 27)       0           conv1d_2[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "max_pooling1d_3 (MaxPooling1D)  (None, 30, 27)       0           conv1d_6[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "multiply_1 (Multiply)           (None, 30, 27)       0           max_pooling1d_1[0][0]            \n",
      "                                                                 max_pooling1d_3[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "lstm_1 (LSTM)                   (None, 30, 60)       21120       multiply_1[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "lstm_2 (LSTM)                   (None, 60)           29040       lstm_1[0][0]                     \n",
      "__________________________________________________________________________________________________\n",
      "dropout_1 (Dropout)             (None, 60)           0           lstm_2[0][0]                     \n",
      "__________________________________________________________________________________________________\n",
      "dense_1 (Dense)                 (None, 10)           610         dropout_1[0][0]                  \n",
      "==================================================================================================\n",
      "Total params: 91,900\n",
      "Trainable params: 91,900\n",
      "Non-trainable params: 0\n",
      "__________________________________________________________________________________________________\n"
     ]
    }
   ],
   "source": [
    "model = built_model()\n",
    "opt = Adam(lr=0.0006)\n",
    "model.compile(optimizer=opt, loss='mean_squared_error', metrics=['accuracy'])\n",
    "model.summary()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "WARNING:tensorflow:From /home/ma-user/anaconda3/envs/TensorFlow-1.13.1/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py:3066: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "Use tf.cast instead.\n",
      "Train on 1680 samples, validate on 720 samples\n",
      "Epoch 1/400\n",
      " - 6s - loss: 0.0898 - acc: 0.1542 - val_loss: 0.0890 - val_acc: 0.0861\n",
      "Epoch 2/400\n",
      " - 2s - loss: 0.0857 - acc: 0.1202 - val_loss: 0.0839 - val_acc: 0.2014\n",
      "Epoch 3/400\n",
      " - 2s - loss: 0.0803 - acc: 0.2226 - val_loss: 0.0806 - val_acc: 0.1903\n",
      "Epoch 4/400\n",
      " - 2s - loss: 0.0779 - acc: 0.2470 - val_loss: 0.0767 - val_acc: 0.2806\n",
      "Epoch 5/400\n",
      " - 2s - loss: 0.0735 - acc: 0.3107 - val_loss: 0.0749 - val_acc: 0.2667\n",
      "Epoch 6/400\n",
      " - 2s - loss: 0.0716 - acc: 0.3226 - val_loss: 0.0768 - val_acc: 0.2750\n",
      "Epoch 7/400\n",
      " - 2s - loss: 0.0712 - acc: 0.3643 - val_loss: 0.0706 - val_acc: 0.3431\n",
      "Epoch 8/400\n",
      " - 2s - loss: 0.0672 - acc: 0.3929 - val_loss: 0.0683 - val_acc: 0.3569\n",
      "Epoch 9/400\n",
      " - 2s - loss: 0.0654 - acc: 0.3976 - val_loss: 0.0668 - val_acc: 0.4736\n",
      "Epoch 10/400\n",
      " - 2s - loss: 0.0639 - acc: 0.4185 - val_loss: 0.0680 - val_acc: 0.3764\n",
      "Epoch 11/400\n",
      " - 2s - loss: 0.0671 - acc: 0.3976 - val_loss: 0.0678 - val_acc: 0.3833\n",
      "Epoch 12/400\n",
      " - 2s - loss: 0.0624 - acc: 0.4512 - val_loss: 0.0636 - val_acc: 0.4444\n",
      "Epoch 13/400\n",
      " - 2s - loss: 0.0594 - acc: 0.4923 - val_loss: 0.0616 - val_acc: 0.4472\n",
      "Epoch 14/400\n",
      " - 2s - loss: 0.0572 - acc: 0.5298 - val_loss: 0.0580 - val_acc: 0.4750\n",
      "Epoch 15/400\n",
      " - 2s - loss: 0.0548 - acc: 0.5464 - val_loss: 0.0559 - val_acc: 0.5292\n",
      "Epoch 16/400\n",
      " - 2s - loss: 0.0524 - acc: 0.5815 - val_loss: 0.0528 - val_acc: 0.5556\n",
      "Epoch 17/400\n",
      " - 2s - loss: 0.0505 - acc: 0.6071 - val_loss: 0.0518 - val_acc: 0.5806\n",
      "Epoch 18/400\n",
      " - 2s - loss: 0.0516 - acc: 0.5762 - val_loss: 0.0511 - val_acc: 0.5736\n",
      "Epoch 19/400\n",
      " - 2s - loss: 0.0476 - acc: 0.6202 - val_loss: 0.0494 - val_acc: 0.5833\n",
      "Epoch 20/400\n",
      " - 2s - loss: 0.0482 - acc: 0.6185 - val_loss: 0.0489 - val_acc: 0.5861\n",
      "Epoch 21/400\n",
      " - 2s - loss: 0.0462 - acc: 0.6310 - val_loss: 0.0482 - val_acc: 0.6028\n",
      "Epoch 22/400\n",
      " - 2s - loss: 0.0454 - acc: 0.6375 - val_loss: 0.0471 - val_acc: 0.6167\n",
      "Epoch 23/400\n",
      " - 2s - loss: 0.0444 - acc: 0.6435 - val_loss: 0.0482 - val_acc: 0.5847\n",
      "Epoch 24/400\n",
      " - 2s - loss: 0.0441 - acc: 0.6482 - val_loss: 0.0460 - val_acc: 0.6125\n",
      "Epoch 25/400\n",
      " - 2s - loss: 0.0436 - acc: 0.6500 - val_loss: 0.0479 - val_acc: 0.5986\n",
      "Epoch 26/400\n",
      " - 2s - loss: 0.0449 - acc: 0.6369 - val_loss: 0.0468 - val_acc: 0.6000\n",
      "Epoch 27/400\n",
      " - 2s - loss: 0.0431 - acc: 0.6601 - val_loss: 0.0487 - val_acc: 0.5806\n",
      "Epoch 28/400\n",
      " - 2s - loss: 0.0429 - acc: 0.6571 - val_loss: 0.0456 - val_acc: 0.6333\n",
      "Epoch 29/400\n",
      " - 2s - loss: 0.0417 - acc: 0.6768 - val_loss: 0.0452 - val_acc: 0.6236\n",
      "Epoch 30/400\n",
      " - 2s - loss: 0.0410 - acc: 0.6833 - val_loss: 0.0454 - val_acc: 0.6417\n",
      "Epoch 31/400\n",
      " - 2s - loss: 0.0404 - acc: 0.6935 - val_loss: 0.0456 - val_acc: 0.6292\n",
      "Epoch 32/400\n",
      " - 2s - loss: 0.0402 - acc: 0.6970 - val_loss: 0.0445 - val_acc: 0.6417\n",
      "Epoch 33/400\n",
      " - 2s - loss: 0.0394 - acc: 0.7107 - val_loss: 0.0458 - val_acc: 0.6167\n",
      "Epoch 34/400\n",
      " - 2s - loss: 0.0393 - acc: 0.7077 - val_loss: 0.0435 - val_acc: 0.6528\n",
      "Epoch 35/400\n",
      " - 2s - loss: 0.0378 - acc: 0.7113 - val_loss: 0.0448 - val_acc: 0.6389\n",
      "Epoch 36/400\n",
      " - 2s - loss: 0.0398 - acc: 0.7048 - val_loss: 0.0639 - val_acc: 0.4875\n",
      "Epoch 37/400\n",
      " - 2s - loss: 0.0483 - acc: 0.6530 - val_loss: 0.0405 - val_acc: 0.7014\n",
      "Epoch 38/400\n",
      " - 2s - loss: 0.0360 - acc: 0.7470 - val_loss: 0.0355 - val_acc: 0.7500\n",
      "Epoch 39/400\n",
      " - 2s - loss: 0.0323 - acc: 0.7780 - val_loss: 0.0382 - val_acc: 0.7486\n",
      "Epoch 40/400\n",
      " - 2s - loss: 0.0326 - acc: 0.7810 - val_loss: 0.0381 - val_acc: 0.6944\n",
      "Epoch 41/400\n",
      " - 2s - loss: 0.0354 - acc: 0.7369 - val_loss: 0.0375 - val_acc: 0.7236\n",
      "Epoch 42/400\n",
      " - 2s - loss: 0.0339 - acc: 0.7601 - val_loss: 0.0345 - val_acc: 0.7417\n",
      "Epoch 43/400\n",
      " - 2s - loss: 0.0335 - acc: 0.7524 - val_loss: 0.0344 - val_acc: 0.7653\n",
      "Epoch 44/400\n",
      " - 2s - loss: 0.0320 - acc: 0.7637 - val_loss: 0.0314 - val_acc: 0.7833\n",
      "Epoch 45/400\n",
      " - 2s - loss: 0.0321 - acc: 0.7798 - val_loss: 0.0313 - val_acc: 0.7542\n",
      "Epoch 46/400\n",
      " - 2s - loss: 0.0272 - acc: 0.8280 - val_loss: 0.0285 - val_acc: 0.8069\n",
      "Epoch 47/400\n",
      " - 2s - loss: 0.0264 - acc: 0.8232 - val_loss: 0.0288 - val_acc: 0.7944\n",
      "Epoch 48/400\n",
      " - 2s - loss: 0.0277 - acc: 0.8048 - val_loss: 0.0295 - val_acc: 0.7806\n",
      "Epoch 49/400\n",
      " - 2s - loss: 0.0260 - acc: 0.8262 - val_loss: 0.0277 - val_acc: 0.8014\n",
      "Epoch 50/400\n",
      " - 2s - loss: 0.0261 - acc: 0.8238 - val_loss: 0.0279 - val_acc: 0.8028\n",
      "Epoch 51/400\n",
      " - 2s - loss: 0.0259 - acc: 0.8185 - val_loss: 0.0275 - val_acc: 0.8014\n",
      "Epoch 52/400\n",
      " - 2s - loss: 0.0251 - acc: 0.8256 - val_loss: 0.0271 - val_acc: 0.7986\n",
      "Epoch 53/400\n",
      " - 2s - loss: 0.0239 - acc: 0.8321 - val_loss: 0.0259 - val_acc: 0.8236\n",
      "Epoch 54/400\n",
      " - 2s - loss: 0.0224 - acc: 0.8470 - val_loss: 0.0335 - val_acc: 0.7375\n",
      "Epoch 55/400\n",
      " - 2s - loss: 0.0289 - acc: 0.7958 - val_loss: 0.0300 - val_acc: 0.7861\n",
      "Epoch 56/400\n",
      " - 2s - loss: 0.0232 - acc: 0.8452 - val_loss: 0.0264 - val_acc: 0.8194\n",
      "Epoch 57/400\n",
      " - 2s - loss: 0.0234 - acc: 0.8375 - val_loss: 0.0285 - val_acc: 0.7903\n",
      "Epoch 58/400\n",
      " - 2s - loss: 0.0234 - acc: 0.8399 - val_loss: 0.0273 - val_acc: 0.8056\n",
      "Epoch 59/400\n",
      " - 2s - loss: 0.0232 - acc: 0.8435 - val_loss: 0.0263 - val_acc: 0.8139\n",
      "Epoch 60/400\n",
      " - 2s - loss: 0.0232 - acc: 0.8357 - val_loss: 0.0250 - val_acc: 0.8250\n",
      "Epoch 61/400\n",
      " - 2s - loss: 0.0225 - acc: 0.8476 - val_loss: 0.0241 - val_acc: 0.8264\n",
      "Epoch 62/400\n",
      " - 2s - loss: 0.0203 - acc: 0.8643 - val_loss: 0.0250 - val_acc: 0.8194\n",
      "Epoch 63/400\n",
      " - 2s - loss: 0.0195 - acc: 0.8589 - val_loss: 0.0236 - val_acc: 0.8278\n",
      "Epoch 64/400\n",
      " - 2s - loss: 0.0203 - acc: 0.8631 - val_loss: 0.0251 - val_acc: 0.8181\n",
      "Epoch 65/400\n",
      " - 2s - loss: 0.0196 - acc: 0.8649 - val_loss: 0.0232 - val_acc: 0.8306\n",
      "Epoch 66/400\n",
      " - 2s - loss: 0.0212 - acc: 0.8536 - val_loss: 0.0279 - val_acc: 0.7986\n",
      "Epoch 67/400\n",
      " - 2s - loss: 0.0199 - acc: 0.8589 - val_loss: 0.0265 - val_acc: 0.8069\n",
      "Epoch 68/400\n",
      " - 2s - loss: 0.0228 - acc: 0.8429 - val_loss: 0.0233 - val_acc: 0.8306\n",
      "Epoch 69/400\n",
      " - 2s - loss: 0.0199 - acc: 0.8679 - val_loss: 0.0247 - val_acc: 0.8181\n",
      "Epoch 70/400\n",
      " - 2s - loss: 0.0186 - acc: 0.8720 - val_loss: 0.0234 - val_acc: 0.8264\n",
      "Epoch 71/400\n",
      " - 2s - loss: 0.0186 - acc: 0.8720 - val_loss: 0.0229 - val_acc: 0.8319\n",
      "Epoch 72/400\n",
      " - 2s - loss: 0.0179 - acc: 0.8732 - val_loss: 0.0237 - val_acc: 0.8319\n",
      "Epoch 73/400\n",
      " - 2s - loss: 0.0186 - acc: 0.8702 - val_loss: 0.0241 - val_acc: 0.8194\n",
      "Epoch 74/400\n",
      " - 2s - loss: 0.0181 - acc: 0.8720 - val_loss: 0.0298 - val_acc: 0.7569\n",
      "Epoch 75/400\n",
      " - 2s - loss: 0.0213 - acc: 0.8560 - val_loss: 0.0274 - val_acc: 0.8069\n",
      "Epoch 76/400\n",
      " - 2s - loss: 0.0188 - acc: 0.8738 - val_loss: 0.0230 - val_acc: 0.8347\n",
      "Epoch 77/400\n",
      " - 2s - loss: 0.0173 - acc: 0.8869 - val_loss: 0.0224 - val_acc: 0.8431\n",
      "Epoch 78/400\n",
      " - 2s - loss: 0.0203 - acc: 0.8631 - val_loss: 0.0215 - val_acc: 0.8444\n",
      "Epoch 79/400\n",
      " - 2s - loss: 0.0176 - acc: 0.8810 - val_loss: 0.0211 - val_acc: 0.8528\n",
      "Epoch 80/400\n",
      " - 2s - loss: 0.0161 - acc: 0.8899 - val_loss: 0.0208 - val_acc: 0.8556\n",
      "Epoch 81/400\n",
      " - 2s - loss: 0.0164 - acc: 0.8863 - val_loss: 0.0197 - val_acc: 0.8681\n",
      "Epoch 82/400\n",
      " - 2s - loss: 0.0151 - acc: 0.8970 - val_loss: 0.0212 - val_acc: 0.8486\n",
      "Epoch 83/400\n",
      " - 2s - loss: 0.0149 - acc: 0.8988 - val_loss: 0.0194 - val_acc: 0.8583\n",
      "Epoch 84/400\n",
      " - 2s - loss: 0.0147 - acc: 0.9036 - val_loss: 0.0198 - val_acc: 0.8569\n",
      "Epoch 85/400\n",
      " - 2s - loss: 0.0146 - acc: 0.9018 - val_loss: 0.0196 - val_acc: 0.8569\n",
      "Epoch 86/400\n",
      " - 2s - loss: 0.0141 - acc: 0.9083 - val_loss: 0.0175 - val_acc: 0.8764\n",
      "Epoch 87/400\n",
      " - 2s - loss: 0.0137 - acc: 0.9137 - val_loss: 0.0189 - val_acc: 0.8653\n",
      "Epoch 88/400\n",
      " - 2s - loss: 0.0124 - acc: 0.9202 - val_loss: 0.0210 - val_acc: 0.8569\n",
      "Epoch 89/400\n",
      " - 2s - loss: 0.0131 - acc: 0.9214 - val_loss: 0.0209 - val_acc: 0.8556\n",
      "Epoch 90/400\n",
      " - 2s - loss: 0.0140 - acc: 0.9119 - val_loss: 0.0224 - val_acc: 0.8542\n",
      "Epoch 91/400\n",
      " - 2s - loss: 0.0143 - acc: 0.9071 - val_loss: 0.0194 - val_acc: 0.8653\n",
      "Epoch 92/400\n",
      " - 2s - loss: 0.0125 - acc: 0.9220 - val_loss: 0.0174 - val_acc: 0.8764\n",
      "Epoch 93/400\n",
      " - 2s - loss: 0.0122 - acc: 0.9244 - val_loss: 0.0168 - val_acc: 0.8861\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 94/400\n",
      " - 2s - loss: 0.0104 - acc: 0.9339 - val_loss: 0.0175 - val_acc: 0.8792\n",
      "Epoch 95/400\n",
      " - 2s - loss: 0.0104 - acc: 0.9387 - val_loss: 0.0155 - val_acc: 0.8917\n",
      "Epoch 96/400\n",
      " - 2s - loss: 0.0097 - acc: 0.9387 - val_loss: 0.0127 - val_acc: 0.9208\n",
      "Epoch 97/400\n",
      " - 2s - loss: 0.0084 - acc: 0.9554 - val_loss: 0.0117 - val_acc: 0.9222\n",
      "Epoch 98/400\n",
      " - 2s - loss: 0.0074 - acc: 0.9565 - val_loss: 0.0118 - val_acc: 0.9236\n",
      "Epoch 99/400\n",
      " - 2s - loss: 0.0066 - acc: 0.9655 - val_loss: 0.0130 - val_acc: 0.9181\n",
      "Epoch 100/400\n",
      " - 2s - loss: 0.0054 - acc: 0.9732 - val_loss: 0.0233 - val_acc: 0.8653\n",
      "Epoch 101/400\n",
      " - 2s - loss: 0.0173 - acc: 0.9083 - val_loss: 0.0190 - val_acc: 0.8736\n",
      "Epoch 102/400\n",
      " - 2s - loss: 0.0096 - acc: 0.9405 - val_loss: 0.0133 - val_acc: 0.9139\n",
      "Epoch 103/400\n",
      " - 2s - loss: 0.0074 - acc: 0.9554 - val_loss: 0.0180 - val_acc: 0.8903\n",
      "Epoch 104/400\n",
      " - 2s - loss: 0.0123 - acc: 0.9345 - val_loss: 0.0171 - val_acc: 0.9028\n",
      "Epoch 105/400\n",
      " - 2s - loss: 0.0122 - acc: 0.9327 - val_loss: 0.0145 - val_acc: 0.9153\n",
      "Epoch 106/400\n",
      " - 2s - loss: 0.0101 - acc: 0.9446 - val_loss: 0.0135 - val_acc: 0.9181\n",
      "Epoch 107/400\n",
      " - 2s - loss: 0.0068 - acc: 0.9637 - val_loss: 0.0089 - val_acc: 0.9417\n",
      "Epoch 108/400\n",
      " - 2s - loss: 0.0042 - acc: 0.9815 - val_loss: 0.0084 - val_acc: 0.9444\n",
      "Epoch 109/400\n",
      " - 2s - loss: 0.0036 - acc: 0.9827 - val_loss: 0.0091 - val_acc: 0.9444\n",
      "Epoch 110/400\n",
      " - 2s - loss: 0.0041 - acc: 0.9780 - val_loss: 0.0115 - val_acc: 0.9278\n",
      "Epoch 111/400\n",
      " - 2s - loss: 0.0172 - acc: 0.8952 - val_loss: 0.0276 - val_acc: 0.8236\n",
      "Epoch 112/400\n",
      " - 2s - loss: 0.0222 - acc: 0.8607 - val_loss: 0.0260 - val_acc: 0.8278\n",
      "Epoch 113/400\n",
      " - 2s - loss: 0.0193 - acc: 0.8738 - val_loss: 0.0270 - val_acc: 0.8125\n",
      "Epoch 114/400\n",
      " - 2s - loss: 0.0181 - acc: 0.8804 - val_loss: 0.0218 - val_acc: 0.8444\n",
      "Epoch 115/400\n",
      " - 2s - loss: 0.0204 - acc: 0.8649 - val_loss: 0.0283 - val_acc: 0.8056\n",
      "Epoch 116/400\n",
      " - 2s - loss: 0.0168 - acc: 0.8821 - val_loss: 0.0210 - val_acc: 0.8444\n",
      "Epoch 117/400\n",
      " - 2s - loss: 0.0151 - acc: 0.8917 - val_loss: 0.0189 - val_acc: 0.8500\n",
      "Epoch 118/400\n",
      " - 2s - loss: 0.0136 - acc: 0.8964 - val_loss: 0.0180 - val_acc: 0.8514\n",
      "Epoch 119/400\n",
      " - 2s - loss: 0.0124 - acc: 0.9018 - val_loss: 0.0177 - val_acc: 0.8472\n",
      "Epoch 120/400\n",
      " - 2s - loss: 0.0104 - acc: 0.9202 - val_loss: 0.0113 - val_acc: 0.9667\n",
      "Epoch 121/400\n",
      " - 2s - loss: 0.0058 - acc: 0.9685 - val_loss: 0.0053 - val_acc: 0.9681\n",
      "Epoch 122/400\n",
      " - 2s - loss: 0.0031 - acc: 0.9869 - val_loss: 0.0063 - val_acc: 0.9611\n",
      "Epoch 123/400\n",
      " - 2s - loss: 0.0022 - acc: 0.9905 - val_loss: 0.0097 - val_acc: 0.9431\n",
      "Epoch 124/400\n",
      " - 2s - loss: 0.0020 - acc: 0.9911 - val_loss: 0.0064 - val_acc: 0.9625\n",
      "Epoch 125/400\n",
      " - 2s - loss: 0.0014 - acc: 0.9958 - val_loss: 0.0051 - val_acc: 0.9694\n",
      "Epoch 126/400\n",
      " - 2s - loss: 0.0013 - acc: 0.9958 - val_loss: 0.0055 - val_acc: 0.9681\n",
      "Epoch 127/400\n",
      " - 2s - loss: 0.0013 - acc: 0.9946 - val_loss: 0.0052 - val_acc: 0.9667\n",
      "Epoch 128/400\n",
      " - 2s - loss: 0.0016 - acc: 0.9923 - val_loss: 0.0050 - val_acc: 0.9694\n",
      "Epoch 129/400\n",
      " - 2s - loss: 0.0013 - acc: 0.9935 - val_loss: 0.0058 - val_acc: 0.9681\n",
      "Epoch 130/400\n",
      " - 2s - loss: 0.0013 - acc: 0.9946 - val_loss: 0.0048 - val_acc: 0.9694\n",
      "Epoch 131/400\n",
      " - 2s - loss: 0.0010 - acc: 0.9964 - val_loss: 0.0045 - val_acc: 0.9750\n",
      "Epoch 132/400\n",
      " - 2s - loss: 0.0012 - acc: 0.9958 - val_loss: 0.0049 - val_acc: 0.9708\n",
      "Epoch 133/400\n",
      " - 2s - loss: 0.0014 - acc: 0.9923 - val_loss: 0.0046 - val_acc: 0.9708\n",
      "Epoch 134/400\n",
      " - 2s - loss: 0.0010 - acc: 0.9964 - val_loss: 0.0057 - val_acc: 0.9653\n",
      "Epoch 135/400\n",
      " - 2s - loss: 0.0012 - acc: 0.9929 - val_loss: 0.0050 - val_acc: 0.9694\n",
      "Epoch 136/400\n",
      " - 2s - loss: 8.7629e-04 - acc: 0.9964 - val_loss: 0.0045 - val_acc: 0.9736\n",
      "Epoch 137/400\n",
      " - 2s - loss: 7.3534e-04 - acc: 0.9976 - val_loss: 0.0044 - val_acc: 0.9750\n",
      "Epoch 138/400\n",
      " - 2s - loss: 6.7181e-04 - acc: 0.9970 - val_loss: 0.0041 - val_acc: 0.9778\n",
      "Epoch 139/400\n",
      " - 2s - loss: 7.0218e-04 - acc: 0.9976 - val_loss: 0.0037 - val_acc: 0.9764\n",
      "Epoch 140/400\n",
      " - 2s - loss: 7.7084e-04 - acc: 0.9970 - val_loss: 0.0041 - val_acc: 0.9750\n",
      "Epoch 141/400\n",
      " - 2s - loss: 8.9288e-04 - acc: 0.9964 - val_loss: 0.0051 - val_acc: 0.9694\n",
      "Epoch 142/400\n",
      " - 2s - loss: 7.4707e-04 - acc: 0.9970 - val_loss: 0.0042 - val_acc: 0.9778\n",
      "Epoch 143/400\n",
      " - 2s - loss: 6.0919e-04 - acc: 0.9976 - val_loss: 0.0038 - val_acc: 0.9792\n",
      "Epoch 144/400\n",
      " - 2s - loss: 6.1097e-04 - acc: 0.9976 - val_loss: 0.0036 - val_acc: 0.9819\n",
      "Epoch 145/400\n",
      " - 2s - loss: 7.6300e-04 - acc: 0.9970 - val_loss: 0.0045 - val_acc: 0.9750\n",
      "Epoch 146/400\n",
      " - 2s - loss: 6.5530e-04 - acc: 0.9976 - val_loss: 0.0037 - val_acc: 0.9806\n",
      "Epoch 147/400\n",
      " - 2s - loss: 6.7530e-04 - acc: 0.9970 - val_loss: 0.0039 - val_acc: 0.9792\n",
      "Epoch 148/400\n",
      " - 2s - loss: 0.0041 - acc: 0.9762 - val_loss: 0.0054 - val_acc: 0.9667\n",
      "Epoch 149/400\n",
      " - 2s - loss: 0.0014 - acc: 0.9923 - val_loss: 0.0038 - val_acc: 0.9750\n",
      "Epoch 150/400\n",
      " - 2s - loss: 0.0011 - acc: 0.9952 - val_loss: 0.0045 - val_acc: 0.9764\n",
      "Epoch 151/400\n",
      " - 2s - loss: 8.7909e-04 - acc: 0.9970 - val_loss: 0.0035 - val_acc: 0.9792\n",
      "Epoch 152/400\n",
      " - 2s - loss: 7.2538e-04 - acc: 0.9970 - val_loss: 0.0079 - val_acc: 0.9528\n",
      "Epoch 153/400\n",
      " - 2s - loss: 0.0012 - acc: 0.9946 - val_loss: 0.0062 - val_acc: 0.9597\n",
      "Epoch 154/400\n",
      " - 2s - loss: 0.0014 - acc: 0.9917 - val_loss: 0.0057 - val_acc: 0.9667\n",
      "Epoch 155/400\n",
      " - 2s - loss: 0.0012 - acc: 0.9935 - val_loss: 0.0052 - val_acc: 0.9653\n",
      "Epoch 156/400\n",
      " - 2s - loss: 8.8653e-04 - acc: 0.9958 - val_loss: 0.0045 - val_acc: 0.9722\n",
      "Epoch 157/400\n",
      " - 2s - loss: 6.1677e-04 - acc: 0.9976 - val_loss: 0.0044 - val_acc: 0.9750\n",
      "Epoch 158/400\n",
      " - 2s - loss: 5.6381e-04 - acc: 0.9970 - val_loss: 0.0041 - val_acc: 0.9792\n",
      "Epoch 159/400\n",
      " - 2s - loss: 4.7437e-04 - acc: 0.9988 - val_loss: 0.0047 - val_acc: 0.9722\n",
      "Epoch 160/400\n",
      " - 2s - loss: 5.3145e-04 - acc: 0.9976 - val_loss: 0.0042 - val_acc: 0.9750\n",
      "Epoch 161/400\n",
      " - 2s - loss: 4.2817e-04 - acc: 0.9982 - val_loss: 0.0046 - val_acc: 0.9722\n",
      "Epoch 162/400\n",
      " - 2s - loss: 4.1978e-04 - acc: 0.9988 - val_loss: 0.0045 - val_acc: 0.9722\n",
      "Epoch 163/400\n",
      " - 2s - loss: 4.3189e-04 - acc: 0.9988 - val_loss: 0.0044 - val_acc: 0.9736\n",
      "Epoch 164/400\n",
      " - 2s - loss: 3.9977e-04 - acc: 0.9988 - val_loss: 0.0046 - val_acc: 0.9736\n",
      "Epoch 165/400\n",
      " - 2s - loss: 4.3329e-04 - acc: 0.9988 - val_loss: 0.0043 - val_acc: 0.9736\n",
      "Epoch 166/400\n",
      " - 2s - loss: 4.2220e-04 - acc: 0.9982 - val_loss: 0.0042 - val_acc: 0.9750\n",
      "Epoch 167/400\n",
      " - 2s - loss: 3.7773e-04 - acc: 0.9988 - val_loss: 0.0043 - val_acc: 0.9736\n",
      "Epoch 168/400\n",
      " - 2s - loss: 4.1174e-04 - acc: 0.9988 - val_loss: 0.0043 - val_acc: 0.9750\n",
      "Epoch 169/400\n",
      " - 2s - loss: 3.7385e-04 - acc: 0.9982 - val_loss: 0.0048 - val_acc: 0.9736\n",
      "Epoch 170/400\n",
      " - 2s - loss: 3.8650e-04 - acc: 0.9988 - val_loss: 0.0049 - val_acc: 0.9736\n",
      "Epoch 171/400\n",
      " - 2s - loss: 4.2148e-04 - acc: 0.9988 - val_loss: 0.0046 - val_acc: 0.9736\n",
      "Epoch 172/400\n",
      " - 2s - loss: 3.3052e-04 - acc: 0.9988 - val_loss: 0.0043 - val_acc: 0.9750\n",
      "Epoch 173/400\n",
      " - 2s - loss: 3.9848e-04 - acc: 0.9988 - val_loss: 0.0045 - val_acc: 0.9736\n",
      "Epoch 174/400\n",
      " - 2s - loss: 3.8743e-04 - acc: 0.9988 - val_loss: 0.0046 - val_acc: 0.9722\n",
      "Epoch 175/400\n",
      " - 2s - loss: 3.4425e-04 - acc: 0.9982 - val_loss: 0.0041 - val_acc: 0.9764\n",
      "Epoch 176/400\n",
      " - 2s - loss: 3.7177e-04 - acc: 0.9982 - val_loss: 0.0044 - val_acc: 0.9736\n",
      "Epoch 177/400\n",
      " - 2s - loss: 3.4408e-04 - acc: 0.9988 - val_loss: 0.0044 - val_acc: 0.9750\n",
      "Epoch 178/400\n",
      " - 2s - loss: 3.5167e-04 - acc: 0.9982 - val_loss: 0.0042 - val_acc: 0.9750\n",
      "Epoch 179/400\n",
      " - 2s - loss: 3.2623e-04 - acc: 0.9982 - val_loss: 0.0041 - val_acc: 0.9764\n",
      "Epoch 180/400\n",
      " - 2s - loss: 3.5385e-04 - acc: 0.9988 - val_loss: 0.0042 - val_acc: 0.9750\n",
      "Epoch 181/400\n",
      " - 2s - loss: 3.7403e-04 - acc: 0.9988 - val_loss: 0.0040 - val_acc: 0.9764\n",
      "Epoch 182/400\n",
      " - 2s - loss: 3.5508e-04 - acc: 0.9988 - val_loss: 0.0041 - val_acc: 0.9764\n",
      "Epoch 183/400\n",
      " - 2s - loss: 3.5665e-04 - acc: 0.9988 - val_loss: 0.0046 - val_acc: 0.9750\n",
      "Epoch 184/400\n",
      " - 2s - loss: 3.0706e-04 - acc: 0.9988 - val_loss: 0.0040 - val_acc: 0.9778\n",
      "Epoch 185/400\n",
      " - 2s - loss: 3.3431e-04 - acc: 0.9988 - val_loss: 0.0040 - val_acc: 0.9778\n",
      "Epoch 186/400\n",
      " - 2s - loss: 3.6991e-04 - acc: 0.9988 - val_loss: 0.0047 - val_acc: 0.9736\n",
      "Epoch 187/400\n",
      " - 2s - loss: 3.0726e-04 - acc: 0.9988 - val_loss: 0.0043 - val_acc: 0.9764\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 188/400\n",
      " - 2s - loss: 3.1542e-04 - acc: 0.9988 - val_loss: 0.0043 - val_acc: 0.9764\n",
      "Epoch 189/400\n",
      " - 2s - loss: 3.1696e-04 - acc: 0.9988 - val_loss: 0.0042 - val_acc: 0.9764\n",
      "Epoch 190/400\n",
      " - 2s - loss: 3.3037e-04 - acc: 0.9988 - val_loss: 0.0045 - val_acc: 0.9736\n",
      "Epoch 191/400\n",
      " - 2s - loss: 2.9387e-04 - acc: 0.9988 - val_loss: 0.0040 - val_acc: 0.9792\n",
      "Epoch 192/400\n",
      " - 2s - loss: 3.6765e-04 - acc: 0.9988 - val_loss: 0.0044 - val_acc: 0.9750\n",
      "Epoch 193/400\n",
      " - 2s - loss: 3.3042e-04 - acc: 0.9988 - val_loss: 0.0044 - val_acc: 0.9764\n",
      "Epoch 194/400\n",
      " - 2s - loss: 3.1275e-04 - acc: 0.9988 - val_loss: 0.0043 - val_acc: 0.9764\n",
      "Epoch 195/400\n",
      " - 2s - loss: 3.0052e-04 - acc: 0.9988 - val_loss: 0.0040 - val_acc: 0.9778\n",
      "Epoch 196/400\n",
      " - 2s - loss: 2.9784e-04 - acc: 0.9988 - val_loss: 0.0044 - val_acc: 0.9764\n",
      "Epoch 197/400\n",
      " - 2s - loss: 3.5731e-04 - acc: 0.9988 - val_loss: 0.0052 - val_acc: 0.9722\n",
      "Epoch 198/400\n",
      " - 2s - loss: 3.1829e-04 - acc: 0.9988 - val_loss: 0.0057 - val_acc: 0.9667\n",
      "Epoch 199/400\n",
      " - 2s - loss: 3.0930e-04 - acc: 0.9988 - val_loss: 0.0049 - val_acc: 0.9722\n",
      "Epoch 200/400\n",
      " - 2s - loss: 3.1662e-04 - acc: 0.9988 - val_loss: 0.0048 - val_acc: 0.9708\n",
      "Epoch 201/400\n",
      " - 2s - loss: 3.0868e-04 - acc: 0.9988 - val_loss: 0.0041 - val_acc: 0.9764\n",
      "Epoch 202/400\n",
      " - 2s - loss: 3.5778e-04 - acc: 0.9988 - val_loss: 0.0044 - val_acc: 0.9764\n",
      "Epoch 203/400\n",
      " - 2s - loss: 3.7918e-04 - acc: 0.9982 - val_loss: 0.0050 - val_acc: 0.9736\n",
      "Epoch 204/400\n",
      " - 2s - loss: 3.4737e-04 - acc: 0.9988 - val_loss: 0.0050 - val_acc: 0.9736\n",
      "Epoch 205/400\n",
      " - 2s - loss: 2.5442e-04 - acc: 0.9988 - val_loss: 0.0050 - val_acc: 0.9736\n",
      "Epoch 206/400\n",
      " - 2s - loss: 3.4488e-04 - acc: 0.9988 - val_loss: 0.0057 - val_acc: 0.9667\n",
      "Epoch 207/400\n",
      " - 2s - loss: 4.0630e-04 - acc: 0.9976 - val_loss: 0.0097 - val_acc: 0.9472\n",
      "Epoch 208/400\n",
      " - 2s - loss: 0.0021 - acc: 0.9863 - val_loss: 0.0089 - val_acc: 0.9500\n",
      "Epoch 209/400\n",
      " - 2s - loss: 0.0047 - acc: 0.9726 - val_loss: 0.0066 - val_acc: 0.9625\n",
      "Epoch 210/400\n",
      " - 2s - loss: 0.0034 - acc: 0.9792 - val_loss: 0.0080 - val_acc: 0.9569\n",
      "Epoch 211/400\n",
      " - 2s - loss: 0.0021 - acc: 0.9881 - val_loss: 0.0075 - val_acc: 0.9542\n",
      "Epoch 212/400\n",
      " - 2s - loss: 0.0017 - acc: 0.9911 - val_loss: 0.0058 - val_acc: 0.9653\n",
      "Epoch 213/400\n",
      " - 2s - loss: 0.0021 - acc: 0.9863 - val_loss: 0.0062 - val_acc: 0.9653\n",
      "Epoch 214/400\n",
      " - 2s - loss: 0.0019 - acc: 0.9887 - val_loss: 0.0053 - val_acc: 0.9681\n",
      "Epoch 215/400\n",
      " - 2s - loss: 0.0013 - acc: 0.9911 - val_loss: 0.0040 - val_acc: 0.9764\n",
      "Epoch 216/400\n",
      " - 2s - loss: 0.0010 - acc: 0.9946 - val_loss: 0.0127 - val_acc: 0.9264\n",
      "Epoch 217/400\n",
      " - 2s - loss: 0.0021 - acc: 0.9887 - val_loss: 0.0061 - val_acc: 0.9625\n",
      "Epoch 218/400\n",
      " - 2s - loss: 0.0017 - acc: 0.9905 - val_loss: 0.0060 - val_acc: 0.9681\n",
      "Epoch 219/400\n",
      " - 2s - loss: 0.0016 - acc: 0.9899 - val_loss: 0.0052 - val_acc: 0.9681\n",
      "Epoch 220/400\n",
      " - 2s - loss: 0.0040 - acc: 0.9768 - val_loss: 0.0053 - val_acc: 0.9653\n",
      "Epoch 221/400\n",
      " - 2s - loss: 0.0051 - acc: 0.9708 - val_loss: 0.0152 - val_acc: 0.9083\n",
      "Epoch 222/400\n",
      " - 2s - loss: 0.0041 - acc: 0.9768 - val_loss: 0.0122 - val_acc: 0.9306\n",
      "Epoch 223/400\n",
      " - 2s - loss: 0.0156 - acc: 0.9107 - val_loss: 0.0089 - val_acc: 0.9417\n",
      "Epoch 224/400\n",
      " - 2s - loss: 0.0066 - acc: 0.9595 - val_loss: 0.0175 - val_acc: 0.9056\n",
      "Epoch 225/400\n",
      " - 2s - loss: 0.0071 - acc: 0.9583 - val_loss: 0.0083 - val_acc: 0.9528\n",
      "Epoch 226/400\n",
      " - 2s - loss: 0.0036 - acc: 0.9780 - val_loss: 0.0042 - val_acc: 0.9778\n",
      "Epoch 227/400\n",
      " - 2s - loss: 0.0013 - acc: 0.9923 - val_loss: 0.0045 - val_acc: 0.9750\n",
      "Epoch 228/400\n",
      " - 2s - loss: 9.6889e-04 - acc: 0.9946 - val_loss: 0.0031 - val_acc: 0.9819\n",
      "Epoch 229/400\n",
      " - 2s - loss: 9.4041e-04 - acc: 0.9952 - val_loss: 0.0052 - val_acc: 0.9694\n",
      "Epoch 230/400\n",
      " - 2s - loss: 9.0142e-04 - acc: 0.9958 - val_loss: 0.0032 - val_acc: 0.9833\n",
      "Epoch 231/400\n",
      " - 2s - loss: 6.8074e-04 - acc: 0.9970 - val_loss: 0.0031 - val_acc: 0.9847\n",
      "Epoch 232/400\n",
      " - 2s - loss: 7.0842e-04 - acc: 0.9970 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 233/400\n",
      " - 2s - loss: 6.8212e-04 - acc: 0.9964 - val_loss: 0.0027 - val_acc: 0.9847\n",
      "Epoch 234/400\n",
      " - 2s - loss: 6.9105e-04 - acc: 0.9970 - val_loss: 0.0027 - val_acc: 0.9847\n",
      "Epoch 235/400\n",
      " - 2s - loss: 6.7548e-04 - acc: 0.9970 - val_loss: 0.0028 - val_acc: 0.9861\n",
      "Epoch 236/400\n",
      " - 2s - loss: 6.4256e-04 - acc: 0.9970 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 237/400\n",
      " - 2s - loss: 6.8664e-04 - acc: 0.9970 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 238/400\n",
      " - 2s - loss: 6.5296e-04 - acc: 0.9964 - val_loss: 0.0054 - val_acc: 0.9667\n",
      "Epoch 239/400\n",
      " - 2s - loss: 0.0021 - acc: 0.9893 - val_loss: 0.0037 - val_acc: 0.9778\n",
      "Epoch 240/400\n",
      " - 2s - loss: 3.8234e-04 - acc: 0.9982 - val_loss: 0.0030 - val_acc: 0.9833\n",
      "Epoch 241/400\n",
      " - 2s - loss: 4.8597e-04 - acc: 0.9976 - val_loss: 0.0032 - val_acc: 0.9806\n",
      "Epoch 242/400\n",
      " - 2s - loss: 2.9560e-04 - acc: 0.9988 - val_loss: 0.0032 - val_acc: 0.9819\n",
      "Epoch 243/400\n",
      " - 2s - loss: 2.5099e-04 - acc: 0.9988 - val_loss: 0.0031 - val_acc: 0.9819\n",
      "Epoch 244/400\n",
      " - 2s - loss: 2.8436e-04 - acc: 0.9988 - val_loss: 0.0029 - val_acc: 0.9833\n",
      "Epoch 245/400\n",
      " - 2s - loss: 2.5566e-04 - acc: 0.9988 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 246/400\n",
      " - 2s - loss: 3.6372e-04 - acc: 0.9982 - val_loss: 0.0030 - val_acc: 0.9833\n",
      "Epoch 247/400\n",
      " - 2s - loss: 1.6532e-04 - acc: 0.9994 - val_loss: 0.0033 - val_acc: 0.9806\n",
      "Epoch 248/400\n",
      " - 2s - loss: 3.6069e-04 - acc: 0.9982 - val_loss: 0.0029 - val_acc: 0.9833\n",
      "Epoch 249/400\n",
      " - 2s - loss: 4.3034e-04 - acc: 0.9976 - val_loss: 0.0047 - val_acc: 0.9736\n",
      "Epoch 250/400\n",
      " - 2s - loss: 8.4149e-04 - acc: 0.9952 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 251/400\n",
      " - 2s - loss: 2.7129e-04 - acc: 0.9988 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 252/400\n",
      " - 2s - loss: 2.5015e-04 - acc: 0.9988 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 253/400\n",
      " - 2s - loss: 2.9385e-04 - acc: 0.9988 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 254/400\n",
      " - 2s - loss: 2.9555e-04 - acc: 0.9988 - val_loss: 0.0028 - val_acc: 0.9861\n",
      "Epoch 255/400\n",
      " - 2s - loss: 1.8827e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 256/400\n",
      " - 2s - loss: 2.1466e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9833\n",
      "Epoch 257/400\n",
      " - 2s - loss: 2.6975e-04 - acc: 0.9988 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 258/400\n",
      " - 2s - loss: 2.5206e-04 - acc: 0.9988 - val_loss: 0.0028 - val_acc: 0.9861\n",
      "Epoch 259/400\n",
      " - 2s - loss: 2.5682e-04 - acc: 0.9988 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 260/400\n",
      " - 2s - loss: 3.6035e-04 - acc: 0.9982 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 261/400\n",
      " - 2s - loss: 2.9934e-04 - acc: 0.9988 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 262/400\n",
      " - 2s - loss: 1.7499e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9847\n",
      "Epoch 263/400\n",
      " - 2s - loss: 2.1558e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9861\n",
      "Epoch 264/400\n",
      " - 2s - loss: 1.7884e-04 - acc: 0.9988 - val_loss: 0.0028 - val_acc: 0.9861\n",
      "Epoch 265/400\n",
      " - 2s - loss: 1.6833e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9833\n",
      "Epoch 266/400\n",
      " - 2s - loss: 3.1031e-04 - acc: 0.9988 - val_loss: 0.0028 - val_acc: 0.9861\n",
      "Epoch 267/400\n",
      " - 2s - loss: 2.4994e-04 - acc: 0.9988 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 268/400\n",
      " - 2s - loss: 1.9991e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 269/400\n",
      " - 2s - loss: 1.2951e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 270/400\n",
      " - 2s - loss: 1.7651e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9861\n",
      "Epoch 271/400\n",
      " - 2s - loss: 1.4978e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9833\n",
      "Epoch 272/400\n",
      " - 2s - loss: 1.6426e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9861\n",
      "Epoch 273/400\n",
      " - 2s - loss: 1.7997e-04 - acc: 0.9994 - val_loss: 0.0025 - val_acc: 0.9875\n",
      "Epoch 274/400\n",
      " - 2s - loss: 1.8664e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 275/400\n",
      " - 2s - loss: 1.9205e-04 - acc: 0.9988 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 276/400\n",
      " - 2s - loss: 1.3706e-04 - acc: 0.9994 - val_loss: 0.0030 - val_acc: 0.9833\n",
      "Epoch 277/400\n",
      " - 2s - loss: 2.0874e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9861\n",
      "Epoch 278/400\n",
      " - 2s - loss: 2.0612e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9861\n",
      "Epoch 279/400\n",
      " - 2s - loss: 1.3411e-04 - acc: 0.9994 - val_loss: 0.0030 - val_acc: 0.9833\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 280/400\n",
      " - 2s - loss: 3.0156e-04 - acc: 0.9982 - val_loss: 0.0037 - val_acc: 0.9764\n",
      "Epoch 281/400\n",
      " - 2s - loss: 2.8638e-04 - acc: 0.9988 - val_loss: 0.0029 - val_acc: 0.9833\n",
      "Epoch 282/400\n",
      " - 2s - loss: 1.6846e-04 - acc: 0.9994 - val_loss: 0.0030 - val_acc: 0.9833\n",
      "Epoch 283/400\n",
      " - 2s - loss: 1.9868e-04 - acc: 0.9988 - val_loss: 0.0030 - val_acc: 0.9833\n",
      "Epoch 284/400\n",
      " - 2s - loss: 1.8125e-04 - acc: 0.9994 - val_loss: 0.0030 - val_acc: 0.9833\n",
      "Epoch 285/400\n",
      " - 2s - loss: 1.3887e-04 - acc: 0.9994 - val_loss: 0.0030 - val_acc: 0.9819\n",
      "Epoch 286/400\n",
      " - 2s - loss: 1.6779e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 287/400\n",
      " - 2s - loss: 2.1033e-04 - acc: 0.9988 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 288/400\n",
      " - 2s - loss: 1.7610e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 289/400\n",
      " - 2s - loss: 1.6463e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 290/400\n",
      " - 2s - loss: 1.5526e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9861\n",
      "Epoch 291/400\n",
      " - 2s - loss: 1.7217e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9833\n",
      "Epoch 292/400\n",
      " - 2s - loss: 1.5474e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9833\n",
      "Epoch 293/400\n",
      " - 2s - loss: 1.6491e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9833\n",
      "Epoch 294/400\n",
      " - 2s - loss: 1.8659e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9861\n",
      "Epoch 295/400\n",
      " - 2s - loss: 1.2269e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9833\n",
      "Epoch 296/400\n",
      " - 2s - loss: 1.4561e-04 - acc: 0.9994 - val_loss: 0.0030 - val_acc: 0.9833\n",
      "Epoch 297/400\n",
      " - 2s - loss: 1.6652e-04 - acc: 0.9994 - val_loss: 0.0030 - val_acc: 0.9847\n",
      "Epoch 298/400\n",
      " - 2s - loss: 2.1128e-04 - acc: 0.9988 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 299/400\n",
      " - 2s - loss: 1.7673e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 300/400\n",
      " - 2s - loss: 1.7800e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 301/400\n",
      " - 2s - loss: 1.3748e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9833\n",
      "Epoch 302/400\n",
      " - 2s - loss: 1.4240e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 303/400\n",
      " - 2s - loss: 1.7168e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 304/400\n",
      " - 2s - loss: 1.2829e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 305/400\n",
      " - 2s - loss: 1.2169e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 306/400\n",
      " - 2s - loss: 1.7520e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 307/400\n",
      " - 2s - loss: 1.3047e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 308/400\n",
      " - 2s - loss: 1.3849e-04 - acc: 0.9994 - val_loss: 0.0026 - val_acc: 0.9847\n",
      "Epoch 309/400\n",
      " - 2s - loss: 1.5448e-04 - acc: 0.9994 - val_loss: 0.0026 - val_acc: 0.9875\n",
      "Epoch 310/400\n",
      " - 2s - loss: 1.4159e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9847\n",
      "Epoch 311/400\n",
      " - 2s - loss: 1.4153e-04 - acc: 0.9994 - val_loss: 0.0031 - val_acc: 0.9833\n",
      "Epoch 312/400\n",
      " - 2s - loss: 1.6122e-04 - acc: 0.9994 - val_loss: 0.0031 - val_acc: 0.9833\n",
      "Epoch 313/400\n",
      " - 2s - loss: 1.6646e-04 - acc: 0.9994 - val_loss: 0.0031 - val_acc: 0.9833\n",
      "Epoch 314/400\n",
      " - 2s - loss: 1.9025e-04 - acc: 0.9994 - val_loss: 0.0030 - val_acc: 0.9833\n",
      "Epoch 315/400\n",
      " - 2s - loss: 1.4161e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9833\n",
      "Epoch 316/400\n",
      " - 2s - loss: 1.8593e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 317/400\n",
      " - 2s - loss: 1.3197e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 318/400\n",
      " - 2s - loss: 1.6296e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9847\n",
      "Epoch 319/400\n",
      " - 2s - loss: 1.0857e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 320/400\n",
      " - 2s - loss: 1.3714e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 321/400\n",
      " - 2s - loss: 1.3669e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 322/400\n",
      " - 2s - loss: 1.2809e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 323/400\n",
      " - 2s - loss: 1.5994e-04 - acc: 0.9994 - val_loss: 0.0026 - val_acc: 0.9861\n",
      "Epoch 324/400\n",
      " - 2s - loss: 1.1354e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 325/400\n",
      " - 2s - loss: 1.5408e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 326/400\n",
      " - 2s - loss: 1.3891e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 327/400\n",
      " - 2s - loss: 1.8024e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 328/400\n",
      " - 2s - loss: 1.3387e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 329/400\n",
      " - 2s - loss: 1.5526e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9833\n",
      "Epoch 330/400\n",
      " - 2s - loss: 1.1274e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 331/400\n",
      " - 2s - loss: 1.3194e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 332/400\n",
      " - 2s - loss: 1.4520e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 333/400\n",
      " - 2s - loss: 1.2441e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 334/400\n",
      " - 2s - loss: 1.1567e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 335/400\n",
      " - 2s - loss: 1.5594e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 336/400\n",
      " - 2s - loss: 1.2064e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 337/400\n",
      " - 2s - loss: 1.3156e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 338/400\n",
      " - 2s - loss: 1.1766e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 339/400\n",
      " - 2s - loss: 1.2596e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 340/400\n",
      " - 2s - loss: 1.2725e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 341/400\n",
      " - 2s - loss: 1.2254e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9847\n",
      "Epoch 342/400\n",
      " - 2s - loss: 1.2843e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 343/400\n",
      " - 2s - loss: 1.0785e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 344/400\n",
      " - 2s - loss: 1.3307e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 345/400\n",
      " - 2s - loss: 1.1445e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 346/400\n",
      " - 2s - loss: 1.5899e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 347/400\n",
      " - 2s - loss: 1.2479e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 348/400\n",
      " - 2s - loss: 1.3224e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 349/400\n",
      " - 2s - loss: 1.2119e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9847\n",
      "Epoch 350/400\n",
      " - 2s - loss: 1.1924e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 351/400\n",
      " - 2s - loss: 1.0179e-04 - acc: 0.9994 - val_loss: 0.0026 - val_acc: 0.9861\n",
      "Epoch 352/400\n",
      " - 2s - loss: 1.5011e-04 - acc: 0.9994 - val_loss: 0.0026 - val_acc: 0.9861\n",
      "Epoch 353/400\n",
      " - 2s - loss: 1.5399e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 354/400\n",
      " - 2s - loss: 1.2609e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 355/400\n",
      " - 2s - loss: 1.4752e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 356/400\n",
      " - 2s - loss: 1.2728e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 357/400\n",
      " - 2s - loss: 1.1888e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 358/400\n",
      " - 2s - loss: 1.3645e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9847\n",
      "Epoch 359/400\n",
      " - 2s - loss: 1.1248e-04 - acc: 0.9994 - val_loss: 0.0026 - val_acc: 0.9861\n",
      "Epoch 360/400\n",
      " - 2s - loss: 1.3145e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9847\n",
      "Epoch 361/400\n",
      " - 2s - loss: 1.6031e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9833\n",
      "Epoch 362/400\n",
      " - 2s - loss: 1.6864e-04 - acc: 0.9988 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 363/400\n",
      " - 2s - loss: 1.3539e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9847\n",
      "Epoch 364/400\n",
      " - 2s - loss: 1.0201e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 365/400\n",
      " - 2s - loss: 1.0285e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 366/400\n",
      " - 2s - loss: 1.3285e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 367/400\n",
      " - 2s - loss: 1.1054e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9847\n",
      "Epoch 368/400\n",
      " - 2s - loss: 9.5268e-05 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9847\n",
      "Epoch 369/400\n",
      " - 2s - loss: 1.1058e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9861\n",
      "Epoch 370/400\n",
      " - 2s - loss: 1.2614e-04 - acc: 0.9994 - val_loss: 0.0029 - val_acc: 0.9847\n",
      "Epoch 371/400\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " - 2s - loss: 1.0498e-04 - acc: 0.9994 - val_loss: 0.0033 - val_acc: 0.9833\n",
      "Epoch 372/400\n",
      " - 2s - loss: 1.6931e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 373/400\n",
      " - 2s - loss: 1.2475e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9847\n",
      "Epoch 374/400\n",
      " - 2s - loss: 1.1898e-04 - acc: 0.9994 - val_loss: 0.0028 - val_acc: 0.9847\n",
      "Epoch 375/400\n",
      " - 2s - loss: 1.0327e-04 - acc: 0.9994 - val_loss: 0.0027 - val_acc: 0.9847\n",
      "Epoch 376/400\n",
      " - 2s - loss: 1.5617e-04 - acc: 0.9994 - val_loss: 0.0026 - val_acc: 0.9861\n",
      "Epoch 377/400\n",
      " - 2s - loss: 1.0384e-04 - acc: 0.9994 - val_loss: 0.0026 - val_acc: 0.9861\n",
      "Epoch 378/400\n",
      " - 2s - loss: 1.3169e-04 - acc: 0.9994 - val_loss: 0.0032 - val_acc: 0.9819\n",
      "Epoch 379/400\n",
      " - 2s - loss: 1.6713e-04 - acc: 0.9988 - val_loss: 0.0026 - val_acc: 0.9861\n",
      "Epoch 380/400\n",
      " - 2s - loss: 0.0049 - acc: 0.9744 - val_loss: 0.0079 - val_acc: 0.9528\n",
      "Epoch 381/400\n",
      " - 2s - loss: 0.0027 - acc: 0.9827 - val_loss: 0.0053 - val_acc: 0.9681\n",
      "Epoch 382/400\n",
      " - 2s - loss: 0.0029 - acc: 0.9845 - val_loss: 0.0033 - val_acc: 0.9819\n",
      "Epoch 383/400\n",
      " - 2s - loss: 0.0043 - acc: 0.9756 - val_loss: 0.0062 - val_acc: 0.9653\n",
      "Epoch 384/400\n",
      " - 2s - loss: 0.0037 - acc: 0.9798 - val_loss: 0.0049 - val_acc: 0.9708\n",
      "Epoch 385/400\n",
      " - 2s - loss: 0.0023 - acc: 0.9869 - val_loss: 0.0036 - val_acc: 0.9792\n",
      "Epoch 386/400\n",
      " - 2s - loss: 0.0028 - acc: 0.9839 - val_loss: 0.0089 - val_acc: 0.9444\n",
      "Epoch 387/400\n",
      " - 2s - loss: 0.0048 - acc: 0.9708 - val_loss: 0.0043 - val_acc: 0.9736\n",
      "Epoch 388/400\n",
      " - 2s - loss: 0.0019 - acc: 0.9881 - val_loss: 0.0076 - val_acc: 0.9514\n",
      "Epoch 389/400\n",
      " - 2s - loss: 0.0017 - acc: 0.9905 - val_loss: 0.0040 - val_acc: 0.9778\n",
      "Epoch 390/400\n",
      " - 2s - loss: 0.0031 - acc: 0.9827 - val_loss: 0.0048 - val_acc: 0.9708\n",
      "Epoch 391/400\n",
      " - 2s - loss: 0.0014 - acc: 0.9929 - val_loss: 0.0041 - val_acc: 0.9778\n",
      "Epoch 392/400\n",
      " - 2s - loss: 5.9183e-04 - acc: 0.9964 - val_loss: 0.0052 - val_acc: 0.9694\n",
      "Epoch 393/400\n",
      " - 2s - loss: 0.0021 - acc: 0.9863 - val_loss: 0.0164 - val_acc: 0.8972\n",
      "Epoch 394/400\n",
      " - 2s - loss: 0.0034 - acc: 0.9792 - val_loss: 0.0087 - val_acc: 0.9500\n",
      "Epoch 395/400\n",
      " - 2s - loss: 0.0017 - acc: 0.9899 - val_loss: 0.0034 - val_acc: 0.9806\n",
      "Epoch 396/400\n",
      " - 2s - loss: 3.9384e-04 - acc: 0.9976 - val_loss: 0.0034 - val_acc: 0.9778\n",
      "Epoch 397/400\n",
      " - 2s - loss: 3.8592e-04 - acc: 0.9982 - val_loss: 0.0037 - val_acc: 0.9764\n",
      "Epoch 398/400\n",
      " - 2s - loss: 3.7958e-04 - acc: 0.9982 - val_loss: 0.0030 - val_acc: 0.9833\n",
      "Epoch 399/400\n",
      " - 2s - loss: 1.5689e-04 - acc: 0.9994 - val_loss: 0.0033 - val_acc: 0.9792\n",
      "Epoch 400/400\n",
      " - 2s - loss: 1.6110e-04 - acc: 0.9994 - val_loss: 0.0030 - val_acc: 0.9819\n"
     ]
    }
   ],
   "source": [
    "history = model.fit(x=X_train, y=y_train, batch_size = 100, epochs=400, \n",
    "                    verbose=2, validation_data=(X_test, y_test),\n",
    "                    shuffle=True, initial_epoch=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "#end_time = time.time()\n",
    "#time = end_time - begain_time\n",
    "#print('time:', time)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUIAAAEkCAYAAABaADjbAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAIABJREFUeJztnXmcHVWZ/r/Pvd1psnUWErJAICBhh0AIEGISEiDDJoMgi6OCjIyIoP4UZVBRHHDAdVBcwkwYHHVEHVRWgWAWAoEQJCD7vgQQkpCEJvvSy/v7o6qTTkjfvrdvnb5Vfd8vn/p0Vd2qp94cbr99Tp3lkZnhOI5TzeQqHYDjOE6l8UToOE7V44nQcZyqxxOh4zhVjydCx3GqHk+EjuNUPZ4IU4qkqZJek/SGpIvK1Pq0pL9LWippQhk610o6q5xYKomkmyWNr3QcTvqQjyNMH5IGAM8DJ8c/HwM+ZGbPd1KvATgIWAL0NLNVScVaKSQdDIw0s1srHYuTfbxGmE5OAR4xs7/GSWsWMKUMvf5m9qaZNXaHJBhzMPDhSgfhdA88EaaTA4AX2hxfDdwOIOmSuLn8gqQT4nP/JulHkmZIWiHp2vj89yQtifeXSHom3j9X0i9bxSXNlTQ53r9C0tuSFku6sG1Qkn4p6dxtzhUdT3tIMkm/jl8F/FDScklHS+ol6ZY4lqclHRJfvwi4Fjgr/nddvo3WGEkLJX17m+ds/nfGx8dIelJSLn4V8TdJ+UKxOt2TmkoH4GyX/sBbrQdm9gaApGOBTwKjgWHAHEmj48s+BRwLvA28IukKM7sUuFSSm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expCk0lUTSV4DHzWxWAO0eRMlkeFyzTVK7V2tyklRjZk0J6/cmSiS9zez+hLVrgH5E5fJUktptnlFHtE7fiwnr9iLqOMmZ2X1Jard5Rh3wgbg1UfVkJhFmmbiJ3NzxlelEUs6bT053xhOh4zhVTxY6SxzHcYLiidBxnKrHE6HjOFWPJ8JuhqR/k/ScpPslzVa0Ym9ndSa3Of5xEfccHA/7KEZ/binPL1fPcQrhibB7clU8H/Z/gM8nIWhmXyzisoPjzXEyReoHVDtlMQBYD5trTI8AB5nZcfFYtV8Tzbx4yswuimel/AHIE80kmdsqJGmumU2O93cgmri/C9FUszOBbwKnxp+fbWbHFBtkvODCTUS+ta+b2T/HH10cr1SzGPg40ELks7EXsAw4K8vDkpz04DXC7sllku4nMrC5Nj43DnjIzI6Lj88Hno5rjsMkHRSf+7OZTSGapN8e5wNPmNkEoilbB5jZ14DvAt8tJQnGDCOacncCMFLSkPj8QjM7imjO7cnAKUBtfO4NosUaHKdsvEbYPbnKzH6zzbmnzezmNsd7A+Pj93D9gZ2B3YlqZgALC+jvQ5QAIaoZlksj8C/APxPNkmmdF/xw/PMx4ANE39cj49ptH+C5BJ7tOF4jrCLWbHP8AvDjuLn7DaIa1utEUxih8Lu+59my0s3XiZIYRM3wXlDygqLnAX8kWqdwbZvzh8Y/DyLyqX0B+H0c8xcBnx7mJIInwurleuCEuAl9AdG6gNcDH4lrXPUF7p0OjImvGwP8b3x+JnCapAeJFo4tlplE60LOiY93jn9OlHQf0Rzz24hWIhoen/t3osTtOGXjU+wcx6l6vEboOE7V44nQcZyqxxOh4zhVjydCx3GqHk+EjuNUPZ4IHcepev4/8XeXQlXVoFcAAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 432x288 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#plt.figure(figsize=(12,9))\n",
    "y_pre = model.predict(X_test)\n",
    "label_pre = np.argmax(y_pre, axis=1)\n",
    "label_true = np.argmax(y_test, axis=1)\n",
    "confusion_mat = confusion_matrix(label_true, label_pre)\n",
    "plot_confusion_matrix(confusion_mat, classes=range(10))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.9.12 ('base')",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  },
  "vscode": {
   "interpreter": {
    "hash": "687babfceed435b0b789f365f3eb8deb566bb1e6accff16ee8a864fea7c0b3c0"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
